/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package TestingMenu;

import collision.Board;
import java.awt.Component;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.Timer;

/**
 *
 * @author Marina
 */
public class StartingMenu extends JFrame implements ActionListener{

     private Timer timer;
     private Component a;
     
    public StartingMenu() {
        a = new Menu1();
        //this.add(a);
        Container contentPane = this.getContentPane();
        contentPane.add(a);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(600, 400);
        setLocationRelativeTo(null);
        setTitle("Collision");
        setResizable(false);
        setVisible(true);
        //addKeyListener(new TAdapter());
       timer = new Timer(1000, this);
        timer.start();
        
    }

    public static void main(String[] args) {
        StartingMenu Lalala = new StartingMenu();
        
    }
    
    
    public void keyPressed(KeyEvent e) {

        int key = e.getKeyCode();

        if (key == KeyEvent.VK_UP) {
            System.out.println("Other~");        
        }
        
        if (key == KeyEvent.VK_SPACE) {
            timer.stop();
            System.out.println("LALALA Space Pressed~");
             //new Board();
            this.add(new Board(640,500));
            //removeAll();
        }

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        this.remove(a);
        this.add(new Board(450,600));
    }
        
        
 private class TAdapter extends KeyAdapter {

        @Override
        public void keyPressed(KeyEvent e) {
           int key = e.getKeyCode();

        if (key == KeyEvent.VK_UP) {
            System.out.println("Other~");        
        }
        
        if (key == KeyEvent.VK_SPACE) {
            System.out.println("LALALA Space Pressed~");
            
            a = new Board(640,500);            
        }
        }
}
          
}
 

